package main

import (
	"ebip/internel/ioc"
	"flag"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	"net/http"
)

// @Description
// @Author 代码小学生王木木
var configFile = flag.String("config", "etc/dev.yaml", "配置文件路径")

func main() {
	engine := InitWebServer(*configFile)
	initPrometheus(ioc.AppConfig.PrometheusPort)
	ioc.SetUpOTEL(ioc.AppConfig)

	engine.Run(ioc.AppConfig.ServicePort)
}

func initPrometheus(addr string) {
	go func() {
		http.Handle("/metrics", promhttp.Handler())
		// 监听端口，可以做成可配置的
		http.ListenAndServe(addr, nil)
	}()
}
